<!DOCTYPE html>
<!-- saved from url=(0034)http://localhost:9001/bl/user/form -->
<html style="height: 100%">

<head lang="en">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <title></title>

    <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1">
    <meta http-equiv="X-UA-Compatible" content="IE=9">
    <meta name="renderer" content="webkit">
    <meta name="description" content="overview &amp; stats">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="keywords" content="">
    <link rel="stylesheet" type="text/css" href="./form_files/jquery.fancybox.css">
    <link href="./form_files/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css">
    <link href="./form_files/bootstrap.min.css" rel="stylesheet">
    <link href="./form_files/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="./form_files/fileinput.css">
    <link href="./form_files/reset.css" rel="stylesheet">
    <link href="./form_files/ant_member.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="./form_files/ant_module.css">
    <link href="./form_files/quote_acution.css" rel="stylesheet">
    <link href="./form_files/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="./form_files/webuploader.css">
    <link rel="stylesheet" type="text/css" href="./form_files/bootstrap-select.css">
    <link rel="stylesheet" type="text/css" href="./form_files/jquery.searchableSelect.css">
    <script src="https://cdn.bootcss.com/jquery/1.12.1/jquery.min.js"></script>
    <style type="text/css">
        @font-face {
            font-family: 'FontAwesome';
            src: url('http://localhost:9001/static/static/plugins/Font-Awesome/fonts/fontawesome-webfont.eot');
            /* IE9 Compat Modes */
            src: url('http://localhost:9001/static/static/plugins/Font-Awesome/fonts/fontawesome-webfont.eot?#iefix') format('embedded-opentype'),
                /* IE6-IE8 */
                url('http://localhost:9001/static/static/plugins/Font-Awesome/fonts/fontawesome-webfont.woff') format('woff'),
                /* Modern Browsers */
                url('http://localhost:9001/static/static/plugins/Font-Awesome/fonts/fontawesome-webfont.ttf') format('truetype'),
                /* Safari, Android, iOS */
                url('http://localhost:9001/static/static/plugins/Font-Awesome/fonts/fontawesome-webfont.svg#fontawesomeregular') format('svg');
            /* Legacy iOS */
            font-weight: normal;
            font-style: normal;
        }

        input:-ms-input-placeholder {
            /* IE */
            color: #999 !important;
        }

        .dataTables_processing {
            z-index: 1000
        }
    </style>



    <link rel="shortcut icon" href="http://localhost:9001/static">

    <style>
        .war {
            min-width: 1600px;
        }

        header {
            height: 60px;
            width: 100%;
            background-color: #1B65B9;
        }

        header .con {
            width: 1150px;
            margin: 0 auto;
            display: flex;
            justify-content: space-between;
            align-items: center;
            color: #fff;
            height: 100%;
        }

        header .logo-re {
            font-size: 22px;
            line-height: 30px;
            font-weight: 700;
        }

        .right-hone a.go {
            color: #fff;
        }

        header .right-hone .hr {
            width: 1px;
            height: 14px;
            display: inline-block;
            margin: 0 21px;
            background-color: #fff;
            vertical-align: middle;
        }

        header .right-hone .p-con {
            display: inline-block;
        }

        header .right-hone .p-con span {
            font-size: 16px;
            font-family: Arial-BoldMT, Arial;
            font-weight: 700;
            line-height: 14px;
        }

        footer {
            padding-top: 24px;
            text-align: center;
        }

        footer p {
            color: #606266;
            font-size: 14px;
            line-height: 19px;
            padding-bottom: 24px;
        }

        .main {
            padding: 32px 0;
        }

        .main-con {
            width: 1150px;
            margin: 0 auto;
            background-color: #fff;
        }

        .main-con-title {
            height: 82px;
            border-bottom: 1px solid #E4E7ED;
            padding: 0 24px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .main-con-title h3 {
            font-size: 18px;
            font-weight: 700;
        }

        .main-con-title .flx-right {
            line-height: 18px;
            font-size: 14px;
        }

        .main-con-title .flex-right span {
            font-size: 16px;
            color: #1B65B9;
            font-family: Arial-BoldMT, Arial;
            font-weight: 700;
        }

        .main-box {
            padding: 16px 64px;
        }

        .main-box .title {
            height: 44px;
            display: flex;
            justify-content: flex-start;
            align-items: center;
            margin-bottom: 32px;
            border-bottom: 2px solid #EBEEF5;
        }

        .main-box .title h3 {
            color: #303133;
            line-height: 19px;
            font-weight: 700;
        }

        .box-con {
            padding-left: 183px;
        }

        .form-divcon {
            margin-bottom: 24px;
            display: flex;
        }

        .form-divcon label {
            display: flex;
            margin-right: 12px;
            justify-content: flex-end;
            align-items: flex-start;
            color: #303133;
            line-height: 40px;
            font-weight: normal;
            width: 145px;
        }

        .form-divcon label em {
            font-style: normal;
            color: #F56C6C;
            margin-right: 3px;
        }

        .form-divcon .box-input {
            display: flex;
            width: 340px;
            position: relative;
        }

        .form-divcon .box-input .form-control {
            flex: 1;
            height: 40px;
        }

        .form-divcon .box-input.danger .form-control {
            border-color: #F56C6C;
        }

        .form-divcon .box-input span.danger-txt {
            position: absolute;
            top: 41px;
            left: 0;
            display: none;
            color: #F56C6C;
        }

        .form-divcon .box-input.danger span.danger-txt {
            display: inline-block;
        }

        .form-divcon .tips {
            padding: 12px;
            background-color: #F0F2F5;
            border-radius: 2px;
            margin-left: 20px;
            line-height: 16px;
            font-size: 13px;
            position: relative;
        }

        .form-divcon .tips:before {
            position: absolute;
            top: 30%;
            left: -19px;
            width: 0;
            height: 0;
            border: 10px solid transparent;
            border-right-color: #F0F2F5;
            content: "";
        }

        .main-btn {
            border-top: 2px solid #EBEEF5;
            padding: 32px 0;
            text-align: center;
        }

        .main-btn .btn-primary {
            width: 340px;
            height: 40px;
            margin-bottom: 20px;
        }

        .main-btn p {
            color: #909399;
        }

        .main-btn p a {
            color: #1B65B9;
        }

        .btn-yzm {
            width: 130px;
            color: #1B65B9;
            border: 1px solid #ccc;
            line-height: 38px;
            text-align: center;
        }

        #success {
            display: flex;
            height: 163px;
            width: 420px;
            align-items: center;
            padding-left: 98px;
            background-color: #fff;
        }

        #success .bluser-dia p {
            color: #606266;
            margin-bottom: 8px;
            line-height: 20px;
        }

        #success .bluser-dia p span {
            color: #1B65B9;
            font-weight: 700;
            vertical-align: middle;
        }

        .form-tip {
            padding-left: 155px;
        }
        .form-tip p.small,
        .form-tip p small {
            font-size: 12px;
            margin: 0;
            color: #909399;
        }

        .form-tip .red {
            color: #F56C6C;
        }

        .file-list {
            display: none;
            color: #606266;
            padding-left: 5px;
        }

        .file-btn {
            position: relative;
            min-width: 60px;
            padding-left: 15px;
            padding-right: 15px;
            height: 32px;
            display: inline-block;
            background: #1B65B9;
            border-radius: 2px;
            color: #fff;
            border: 0 none;
        }

        .file-btn input {
            position: absolute;
            top: 0;
            left: 0;
            opacity: 0;
            width: 100%;
            height: 100%;
        }

        .file-list button {
            background: none;
            border-radius: 2px;
            border: 0 none;
        }
    </style>
    <link rel="stylesheet" href="./form_files/layer.css" id="layui_layer_skinlayercss" style="">
</head>

<body style="background-color: #F5F7FA;">
    <div class="war">
        <header class="bluser">
            <div class="con">
                <div class="logo-re">
                    药品和医用耗材招采管理子系统
                </div>
                <div class="header-left right-hone">
                    <a class="go" href="http://localhost:9001/bl/user/form#">
                        返回登录页
                    </a>
                    <span class="hr"></span>
                    <p class="p-con">
                        服务热线：<span>400-618-2090</span>
                    </p>
                </div>
            </div>
        </header>
        <div class="main">
            <form>
                <div class="main-con">
                    <div class="main-con-title">
                        <h3>医疗机构注册申请</h3>
                        <div class="flex-right">
                            温馨提示：如注册时遇到任何问题，可随时拨打客服热线：
                            <span>400-618-2090</span>
                        </div>
                    </div>
                    <div class="main-box">
                        <div class="title">
                            <h3>机构信息</h3>
                        </div>
                        <div class="box-con">
                            <div class="form-divcon">
                                <label>
                                    <em>*</em>所属城市
                                </label>
                                <div class="box-input danger">
                                    <select name="regionId" class="form-control" style="margin-right: 7px;">
                                        <option value="">选择省</option>
                                        <option value=""></option>
                                    </select>
                                    <select name="region2d" class="form-control">
                                        <option value="">选择市</option>
                                        <option value=""></option>
                                    </select>
                                    <span class="danger-txt">错误提示</span>
                                </div>
                            </div>
                            <div class="form-divcon">
                                <label>
                                    <em>*</em>机构名称
                                </label>
                                <div class="box-input danger">
                                    <input name="orgName" class="form-control" type="text">
                                </div>
                                <div class="tips">
                                    机构/单位名称必须与许可证一致
                                </div>
                            </div>
                            <div class="form-divcon">
                                <label>
                                    <em>*</em>医疗机构类型
                                </label>
                                <div class="box-input danger">
                                    <select name="orgType" class="form-control" style="margin-right: 7px;">
                                        <option value="1">医疗机构</option>
                                    </select>
                                    <span class="danger-txt">错误提示</span>
                                </div>
                            </div>
                            <div class="form-divcon">
                                <label>
                                    <em>*</em>医疗机构级别
                                </label>
                                <div class="box-input danger">
                                    <select name="orgSubType" class="form-control" style="margin-right: 7px;">
                                        <option value="1">公立医疗机构</option>
                                        <option value="2">军队医疗机构</option>
                                        <option value="3">非公立医疗机构</option>
                                    </select>
                                    <span class="danger-txt">错误提示</span>
                                </div>
                            </div>
                            <div class="form-divcon">
                                <label>
                                    <em>*</em>医疗机构等次
                                </label>
                                <div class="box-input danger">
                                    <select name="hospitalLevel" class="form-control" style="margin-right: 7px;">
                                        <option value="">请选择</option>
                                        <option selected="" value="1">甲等</option>
                                        <option value="2">乙等</option>
                                        <option value="3">丙等</option>
                                        <option value="4">未定级</option>
                                    </select>
                                    <span class="danger-txt">错误提示</span>
                                </div>
                            </div>
                            <div class="form-divcon">
                                <label>
                                    <em>*</em>法定代表人
                                </label>
                                <div class="box-input danger">
                                    <input name="field1" class="form-control" type="text">
                                </div>
                                <div class="tips">
                                    机构/单位名称必须与许可证一致
                                </div>
                            </div>
                            <div class="form-divcon">
                                <label>
                                    <em>*</em>注册地址
                                </label>
                                <div class="box-input danger" style="flex-wrap: wrap;">
                                    <select name="field2" class="form-control" style="margin-right: 7px;width: 160px;">
                                        <option value="">选择省</option>
                                        <option value=""></option>
                                    </select>
                                    <select name="field3" class="form-control" style="width: 160px;">
                                        <option value="">选择市</option>
                                        <option value=""></option>
                                    </select>
                                    <input name="field4" class="form-control" type="text"
                                        style="width: 300px;margin-top: 8px;">
                                    <span class="danger-txt" style="top: 88px;">错误提示</span>
                                </div>
                            </div>
                            <div class="form-divcon">
                                <label>
                                    <em>*</em>许可证
                                </label>
                                <div class="box-input danger">
                                    <input name="field5" class="form-control" type="text">
                                    <span class="danger-txt">错误提示</span>
                                </div>
                                <div class="tips">
                                    医疗机构执业许可证登记号/对外有偿服务许可证编号
                                </div>
                            </div>
                            <div class="form-divcon">
                                <label>
                                    <em>*</em>许可证扫描件
                                </label>
                                <div class="box-input danger">
                                    <div>
                                        <button class="file-btn" type="button">
                                            上传
                                            <input name="file" class="form-control" type="file">
                                        </button>
                                    </div>
                                    <span class="danger-txt">错误提示</span>
                                </div>
                            </div>
                            <div class="form-tip">
                                <p><small>医疗机构执业许可证/对外有偿服务许可证扫描件</small></p>
                                <p class="red">注：彩色扫描件上传，最大不超过5M</p>
                                <p class="file-list"><span data-name="file"></span><button type="button">×</button>
                                </p>
                            </div>

                        </div>
                    </div>
                    <div class="main-box">
                        <div class="title">
                            <h3>机构信息</h3>
                        </div>
                        <div class="box-con">
                            <div class="form-divcon">
                                <label>
                                    <em>*</em>经办人
                                </label>
                                <div class="box-input danger">
                                    <input name="field6" class="form-control" type="text">
                                </div>
                            </div>
                            <div class="form-divcon">
                                <label>
                                    <em>*</em>经办人手机号
                                </label>
                                <div class="box-input danger">
                                    <input name="phone" class="form-control" type="text">
                                </div>
                                <div class="tips">
                                    机构/单位名称必须与许可证一致
                                </div>
                            </div>
                            <div class="form-divcon">
                                <label>
                                    <em>*</em>经办人手机验证码
                                </label>
                                <div class="box-input">
                                    <input name="field7" class="form-control" type="text">
                                    <a id="btnVertifyCode" href="http://localhost:9001/bl/user/form#" class="btn-yzm">
                                        获取手机验证码
                                    </a>
                                </div>
                            </div>
                            <div class="form-divcon">
                                <label>
                                    <em>*</em>经办人邮箱地址
                                </label>
                                <div class="box-input">
                                    <input name="field8" class="form-control" type="text">
                                </div>
                            </div>
                            <div class="form-divcon">
                                <label>
                                    <em>*</em>经办人身份证号
                                </label>
                                <div class="box-input">
                                    <input name="field9" class="form-control" type="text">
                                </div>
                            </div>


                            <div class="form-divcon">
                                <label>
                                    <em>*</em>设置密码
                                </label>
                                <div class="box-input">
                                    <input name="password" class="form-control" type="text">
                                </div>
                            </div>
                            <div class="form-divcon">
                                <label>
                                    <em>*</em>再次输入密码
                                </label>
                                <div class="box-input">
                                    <input name="repeatPassword" class="form-control" type="text">
                                </div>
                            </div>
                            <div class="form-divcon">
                                <label>
                                    <em>*</em>经办人身份证扫描件
                                </label>
                                <div class="box-input danger">
                                    <div>
                                        <button class="file-btn" type="button">
                                            上传正面
                                            <input name="file1" class="form-control" type="file">
                                        </button>
                                    </div>
                                    <span class="danger-txt">错误提示</span>
                                </div>
                            </div>
                            <div class="form-tip">
                                <p class="red">注：彩色扫描件上传，最大不超过5M</p>
                                <p class="file-list"><span data-name="file1"></span><button type="button">×</button>
                                </p>
                            </div>
                            <div class="form-divcon">
                                <label>
                                </label>
                                <div class="box-input danger">
                                    <div>
                                        <button class="file-btn" type="button">
                                            上传反面
                                            <input name="file2" class="form-control" type="file">
                                        </button>
                                    </div>
                                    <span class="danger-txt">错误提示</span>
                                </div>
                            </div>
                            <div class="form-tip">
                                <p class="red">注：彩色扫描件上传，最大不超过5M</p>
                                <p class="file-list"><span data-name="file2"></span><button type="button">×</button>
                                </p>
                            </div>

                            <div class="form-divcon">
                                <label>
                                    <em>*</em>经办人人证合一
                                </label>
                                <div class="box-input danger">
                                    <div>
                                        <button class="file-btn" type="button">
                                            上传照片
                                            <input name="file1" class="form-control" type="file">
                                        </button>
                                    </div>
                                    <span class="danger-txt">错误提示</span>
                                </div>
                            </div>
                            <div class="form-tip">
                                <p class="small">
                                    要求说明:
                                </p>
                                <p class="small">
                                    1、手指不可遮挡身份证信息；
                                </p>
                                <p class="small">
                                    2、照片需免冠，建议未化妆，五官清晰可见；
                                </p>
                                <p class="small">
                                    3、照片内容真实有效，不得做任何修改；
                                </p>
                                <p class="small">
                                    4、支持.jpg .jpeg格式照片，大小不超过2M。
                                </p>
                                <p class="red">注：彩色扫描件上传，最大不超过5M</p>
                                <p class="file-list"><span data-name="file1"></span><button type="button">×</button>
                                </p>
                            </div>
                        </div>
                    </div>
                    <div class="main-btn">
                        <button class="btn btn-primary" id="register">
                            立即注册
                        </button>
                        <p>
                            我已有账号,<a href="http://localhost:9001/bl/user/form#">立即登录</a>
                        </p>
                    </div>
                </div>
            </form>
        </div>
        <footer>
            <p>管理单位： 国家医疗保障局&nbsp;&nbsp;&nbsp;&nbsp;承建单位： 厦门海西医药交易中心有限公司&nbsp;&nbsp;&nbsp;&nbsp;技术支持：厦门海西医药交易中心有限公司</p>
        </footer>
        <div id="success" style="display: none;">
            <div class="bluser-dia">
                <p>恭喜您已注册成功</p>
                <p>登录账号为：<span>136969174782</span></p>
            </div>
        </div>
    </div>
    <script type="text/javascript" src="./form_files/jquery.min.js.下载"></script>
    <script src="./form_files/jquery.dataTables.min.js.下载"></script>
    <script src="./form_files/dataTables.bootstrap.js.下载"></script>
    <script src="./form_files/dataTables.fixedColumns.min.js.下载" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" src="./form_files/jquery.tips.js.下载"></script>
    <script src="./form_files/bootstrap.min.js.下载"></script>
    <script src="./form_files/layer.js.下载"></script>
    <script src="./form_files/Barrett.js.下载"></script>
    <script src="./form_files/BigInt.js.下载"></script>
    <script src="./form_files/RSA.js.下载"></script>
    <script src="./form_files/CAWebSocket.js.下载" +math.random()="" type="text/javascript"></script>
    <script type="text/javascript" language="JavaScript" charset="utf-8">
        var contextUrl = "";
        var MM_contentVersion = 6;
        var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin
            : 0;
        if (plugin) {
            var words = navigator.plugins["Shockwave Flash"].description.split(" ");
            for (var i = 0; i < words.length; ++i) {
                if (isNaN(parseInt(words[i])))
                    continue;
                var MM_PluginVersion = words[i];
            }
            var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
        } else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE") >= 0
            && (navigator.appVersion.indexOf("Win") != -1)) {
            document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
            document.write('on error resume next \n');
            document
                .write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
            document.write('</SCR' + 'IPT\> \n');
        }
        if (MM_FlashCanPlay) {
        } else {
            var ie_falsh = '<div class="ie_falsh">您的IE版本过低导致网站部分功能无法使用，建议更换浏览器或者安装部分插件<a href="/helpcenter/fileDownload?fileName=Adobe Flash Player ActiveX插件(上传控件使用).exe">立即安装</a></div>'
        }

        changeCode();

        $('#codeImg').click(function () {
            changeCode();
        });
        $('#clogin').click(function () {
            $(".fix-login").fadeOut(100);
        });
        //服务器校验
        $('#to-recover').click(function () {
            if (check()) {
                //var w = window.open("http://localhost:9001/static/static/loading.html");
                var loginname = $("#loginname").val();
                var password = $("#password").val();
                setMaxDigits(130);
                var publicKey = getLoginPublicKey();
                var key = new RSAKeyPair("10001", "", publicKey);
                password = encryptedString(key, encodeURIComponent(password));

                var code = $("#code").val();
                $.ajax({
                    type: "POST",
                    url: '/login/checkUser',
                    data: {
                        account: loginname,
                        password: password,
                        code: code,
                        publicKey: publicKey
                    },
                    dataType: 'json',
                    async: false,
                    cache: false,
                    success: function (data) {
                        if (data.success) {
                            window.location.href = "/";
                        } else {
                            changeCode();
                            //w.close();
                            if (1007 == data.code) {
                                $("#code").addClass('error').next('span').html(data.msg);
                                $("#code").focus();
                            } else {
                                $("#loginname").addClass('error').next('span').html(data.msg);
                                $("#password").addClass('error').next('span').html(data.msg);
                            }
                        }
                    }
                });
            }
        });
        $(function () {
            var timers, time = 0;
            setTimeout("switchfangz()", time)

        });

        function switchfangz() {
            var fangz = $('.fangz');
            if (fangz.is(':visible')) {
                $('.fangz').fadeOut(2000);
                time = 5000;
            } else {
                $('.fangz').fadeIn(2000);
                time = 10000;
            }
            timers = setTimeout("switchfangz()", time)

        }
        function changeCode() {
            $("#code").val("");
            $("#codeImg").attr("src", "/code?t=" + genTimestamp());
        }
        $("#loginname").blur(function () {
            if ($(this).val() == "") {
                $(this).addClass('error').next('span').html('用户名不能为空');
            } else {
                $(this).removeClass('error');
            }
        })
        $("#password").blur(function () {
            if ($(this).val() == "") {
                $(this).addClass('error').next('span').html('密码不能为空');
            } else {
                $(this).removeClass('error');
            }
        })
        $("#code").blur(function () {
            if ($(this).val() == "") {
                $(this).addClass('error').next('span').html('验证码不能为空');
            } else {
                $(this).removeClass('error');
            }
        })

        //客户端校验
        function check() {
            if ($("#loginname").val() == "") {
                $("#loginname").addClass('error').next('span').html('用户名不能为空');
                $("#loginname").focus();
                return false;
            } else {
                $("#loginname").removeClass('error');
                $("#loginname").val(jQuery.trim($('#loginname').val()));
            }

            if ($("#password").val() == "") {
                $("#password").addClass('error').next('span').html('密码不能为空');
                $("#password").focus();
                return false;
            } else {
                $("#password").removeClass('error');
                $("#password").val(jQuery.trim($('#password').val()));
            }
            if ($("#code").val() == "") {
                $("#code").addClass('error').next('span').html('验证码不能为空');
                $("#code").focus();
                return false;
            } else {
                $("#code").removeClass('error');
            }

            $("#loginbox").tips({
                side: 1,
                msg: '正在登录 , 请稍后 ...',
                bg: '#68B500',
                time: 3
            });

            return true;
        }

        function savePaw() {
            if (!$("#saveid").attr("checked")) {
                $.cookie('loginname', '', {
                    expires: -1
                });
                $.cookie('password', '', {
                    expires: -1
                });
                $("#loginname").val('');
                $("#password").val('');
            }
        }

        function genTimestamp() {
            var time = new Date();
            return time.getTime();
        }

        function quxiao() {
            $("#loginname").val('');
            $("#password").val('');
        }

        /*
         注册
         */
        function register() {
            window.location.href = "/register/forwardToRegister";
        }
        /*
         忘记密码
         */
        function forgetPassword() {
            window.location.href = "/register/forgetPassword";
        }

        //TOCMAT重启之后 点击左侧列表跳转登录首页
        if (window != top) {
            top.location.href = location.href;
        }
        ;

        $(document).keyup(function (event) {
            if (event.keyCode == 13) {
                $("#to-recover").trigger("click");
            }
        });



        $(function () {
            $('#myTab a').click(function (e) {
                e.preventDefault()
                $(this).tab('show')
            });



        });
        // web socket 链接
        /*
         * @description IE10及以上浏览器环境，登录/绑定ca，通过socket建立通信
         * @create 20190905
         * @param [serR] 后端返回的随机数
         * @param [cb] 自定义open事件的回调
         * @param [url] 自定义socket远程连接地址，31212端口用于验证、31213端口用于签章
         * @param [serR] 后端返回的随机数
         * @param [PluginRequest] 凯特api请求的类型，如下：
         * @param [Batch_SignData] 根据随机数与证书签名加密的api
         * @params [onBatch_EnvelopeDataByP7] 对原文进行加密的api
         * @params [onBatch_UnenvelopeDataByP7] 对密文进行解密的api
         */

        function getRndNum(n) {
            var rnd = "";
            for (var i = 0; i < n; i++) {
                rnd += Math.floor(Math.random() * 10);
            }
            return rnd;
        }

        // 校验CA证书有效期
        var checkCaExpDate = function () {
            var strData;//随机数
            var strSignedData;//加密后的随机数
            var strCertData;//证书公钥
            var lRet;
            //对后台传递随机数用用户的证书进行加密
            if (!caManager.caCheck()) {
                alert("为保证正常加密/解密，请插入CA证书！");
                return false;
            } else {
                strData = getRndNum(24);
                caManager.getCertAndSignData(strData).then(function (result) {
                    strSignedData = result.split('||')[0];
                    strCertData = result.split('||')[1];
                    $.ajax({
                        type: "POST",
                        url: '/login/checkCaExpDate',
                        data: {
                            strData: strData,
                            strSignedData: strSignedData,
                            strCertData: strCertData
                        },
                        dataType: 'json',
                        async: false,
                        cache: false,
                        error: function (request) {
                            alert("Connection error");
                        },
                        success: function (data) {
                            if (data.code == "0" && data.msg > 0) {
                                $("#showExpDate").html(data.msg);
                                $("[sign='expDateCaWidgetTip']").show();
                            } else if (data.code == "0" && data.msg < 1) {
                                $("[sign='expDateCaWidgetTipNologin']").show();
                                $("#caLoginBtn").attr("disabled", "true");
                            } else if (data.code == "1") {
                                alert(data.msg);
                            }
                        }
                    });
                }).fail(function (msg) {
                    alert(msg);
                });
            }
        }

        function isAuthCa() {
            if (!caManager.caCheck()) {
                // alert("KSEnAndSignCtl.ocx控件未安装！");
                $("[sign='caWidgetTip']").show();
                return false;
            } else {
                $("[sign='caWidgetTip']").hide();
            }
            return true;
        }
        function isAuthCaValidate() {
            if (!caManager.caCheck()) {
                // alert("KSEnAndSignCtl.ocx控件未安装！");
                $("[sign='caWidgetTip']").show();
                return false;
            } else {
                checkCaExpDate();
            }
            return true;
        }

        var caManager = '';
        var indexLoad = '';
        $("#caLoginBtn").click(function () {
            indexLoad = layer.load(2, {
                shade: [0.2, '#fff'] //0.1透明度的白色背景
            });
            caManager = new CAManager();
            setTimeout(function () {
                caLogin();
            }, 500)
        });
        var relinkI = 0;
        function relink(flb) {
            relinkI++;
            if (flb && relinkI < 5) {
                console.log('我重新链接了！')
                caManager.close();
                caManager = new CAManager();
            } else {
                layer.close(indexLoad);
                layer.alert("CA证书有误，请检查证书是否启动后刷新当前页面！")
            }
        }
        function caLogin() {
            if (caManager.webSocket.readyState == 1) {
                $.getJSON(contextUrl + '/login/getSecAuthRandom?rad=' + Math.random()).then(function (result) {
                    //后端返回随机数
                    var rad = result.data;
                    var url = contextUrl + '/login/caCheckUser?' + Math.random();
                    //获取ca的cert和sign
                    caManager.getCertAndSignData(rad).then(function (res) {
                        let cert = res.split('||')[1];
                        let sign = res.split('||')[0];
                        let postData = {
                            strData: rad,
                            strSignedData: sign,
                            strCertData: cert
                        };
                        $.post(url, postData).then(function (response) {
                            if (response.success) {
                                window.location.href = contextUrl + "/";
                            } else {
                                layer.close(indexLoad)
                                $("#caLoginBtn").tips({
                                    side: 1,
                                    msg: response.msg,
                                    bg: '#FF5080',
                                    time: 3
                                });
                            }
                        });
                    }).fail(function (msg) {
                        alert(msg);
                    });
                });
            } else {

            }
        }
        window.alert = function (msg) {
            layer.close(indexLoad)
            layer.alert(msg)
        }

        //获取登陆公钥
        function getLoginPublicKey() {
            var publicKey = "";
            //获取登陆公钥
            $.ajax({
                type: "POST",
                url: '/login/getLoginKey',
                dataType: 'text',
                async: false,
                success: function (data) {
                    publicKey = data;
                }
            });
            return publicKey;
        }

    </script>
    <script>
        $(document).ready(function () {
            $("#register").on("click", doRegister);
        });

        function doRegister() {
            // var data = {};
            // var t = $('form').serializeArray();
            // $.each(t, function() {
            //     data[this.name] = this.value;
            // });
            // console.log(data);

            // layer.open({
            //     type:1,
            //     title:'操作提示',
            //     closeBtn: 0, //不显示关闭按钮
            //     area: ['auto'],
            //     shadeClose: true, //开启遮罩关闭
            //     content:$("#success")
            // })
        }
        // file
        $(".file-btn").on('click', function () {
            $(this).children().trigger('change')
        })
        $('body').on('change', 'input[type=file]', function (e) {
            var files = this.files
            var max = 5 * 1024 * 1024;
            if (files.length > 1) {
                dangerShow($(this), '只能上传一个文件')
            } else if (max < files[0].size) {
                dangerShow($(this), '不能大于5M')
            } else {
                dangerHide($(this))
                var targetName = $(this).attr('name')
                var $file = $('[data-name=' + targetName + ']')
                $file.html(files[0].name);
                $file.parent().show()
            }
        })
        $(".file-list button").on("click", function () {
            var $parent = $(this).parent();
            $parent.hide();
            var $name = $parent.find('[data-name]');
            var name = $name.data('name');
            var $file = $("[name=" + name + ']');
            $file.after("<input type='file' class='form-control' name='" + name + "' >")
            $file.remove();


        })

        // 添加错误提示
        function dangerShow($target, content) {
            var $parent = $target.parents('.box-input');
            $parent.addClass('danger') // 添加错误提示
            $parent.find(".danger-txt").html(content)
        }
        // 隐藏
        function dangerHide($target) {
            var $parent = $target.parents('.box-input');
            $parent.removeClass('danger') // 添加错误提示
        }


    </script>


</body>

</html>